package com.example.demo.mapper;

import com.example.demo.model.UserScore;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ScoreMapper {
    @Select("SELECT * FROM score")
    public List<UserScore> getAll();

    @Insert("INSERT INTO score(name,sex,score) VALUES(#{name}, #{sex}, #{score})")
    public int addUserScore(UserScore userScore);

    @Update("UPDATE score SET name = #{name},sex = #{sex},score = #{score} WHERE id = #{id}")
    public int updateUserScore(UserScore userScore);

    @Delete("DELETE FROM score WHERE id = #{id}")
    public int deleteUserScoreById(int id);

    @Select("SELECT * FROM score WHERE id = #{id}")
    public UserScore getUserScoreById(int id);
}
